package com.hzit.service.impl;

import com.hzit.entity.User;
import com.hzit.mapper.UserMapper;
import com.hzit.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * 类名：
 * 作者：WF
 * 功能：
 */
@Service

public class UserServiceImpl implements UserService {
	@Autowired
	private UserMapper userMapper;

	@Transactional
	@Override
	public void trans(int uid1, int uid2, int money) {
		//1. 转出
		userMapper.update(uid1,money);
		// int i = 10/0;
		//2. 转入
		userMapper.update(uid2,-money);
	}
}
